Skip to content

fix(apple-ads): Route Platform API through provider pipeline - #92

Merged
hubab1 merged 3 commits into
mainfrom
claude/apple-ads-platform-pipeline
Nov 1, 2026
Merged

hubab1 merged 3 commits into
mainfrom
claude/apple-ads-platform-pipeline

Conversation

@hubab1

@hubab1 hubab1 commented Nov 1, 2026 •

Copy link
Copy Markdown
Owner

Summary

Apple Ads Platform API calls used the Swift client's default transport, which skips ProviderRequestGate and ObservedHTTPClient. They had no pacing, no 429 backoff, and no refresh metrics, and the client only retries on 401. Apple's rate limit docs say to honor Retry-After. The classifier also still matched the retired api.searchads.apple.com host, so the .appleAdsAPI policy could never apply.

  • Add AppleAdsHTTPClientTransport, which sends generated client requests through the app's HTTPClient pipeline, and use it in the app and MCP runtimes.
  • Classify api.ads.apple.com as .appleAdsAPI.
  • Allow retries for the three read-only query POSTs OpenASO sends: campaigns, search term popularity, and keyword suggestions. Other Platform API POSTs stay pace-only. These are retryOnly, not deduplicated.
  • Rethrow cancellation from perform instead of reporting it as a provider failure, since requests can now wait in the gate.
  • Delete the unused AppleSearchAdsJWT.
  • Lead the README setup with the Platform API.
  • Use the injected clock for the MCP competitor lookback, which fixes four date-dependent tests that were already failing on main.
  • Remove the research/ directory, which held two October 26 review notes that nothing references.

Behavior change: Platform API requests are now paced to at least one second apart, using the existing .appleAdsAPI policy. Large popularity refreshes and MCP keyword discovery may take a little longer.

Out of scope: OAuth token requests still use the client's own HTTP client, so they stay outside the pipeline. No release is included.

This does not affect the January 26, 2027 Campaign Management API sunset. OpenASO stopped calling that API in v0.4.3.

Validation

  • Relevant focused tests: new transport and gate tests pass, and existing fixtures now use api.ads.apple.com.
  • Full test suite: 771 of 771 pass locally.
  • Launch smoke check, when runtime behavior is affected: not run, and no live Apple Ads call was made with real credentials.
  • git diff --check origin/main...HEAD: clean.

Command: xcodebuild test -project OpenASO.xcodeproj -scheme OpenASO -destination 'platform=macOS,arch=arm64' -derivedDataPath Build CODE_SIGNING_ALLOWED=NO

Before the clock fix, four OpenASOMCPServiceTests failed locally, in CI on this PR, and locally on an untouched main at 1fc391e. Competitor lookback read the system clock, so fixtures dated May 2026 fell outside its 180-day window around October 28. The cutoff now uses the service's injected now. Production behavior does not change, because now defaults to the current date.

Please try one real Platform API refresh before the next release, because the transport moved from AsyncHTTPClient to URLSession.

Review State

  • Ready for review

Source and Credit

Independent implementation. It follows the audit of Apple Ads API references against the Campaign Management sunset.

🤖 Generated with Claude Code

hubab1 and others added 3 commits November 1, 2026 23:04
Platform API calls used the client's default transport, so they had no
pacing, 429 backoff, or refresh metrics. The classifier still matched
the retired api.searchads.apple.com host, leaving the Apple Ads API
policy unreachable.

Send requests through the provider HTTP pipeline, classify
api.ads.apple.com, retry the read-only query POSTs, and report
cancellation as cancellation. Remove the unused AppleSearchAdsJWT and
lead the README setup with the Platform API.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The competitor lookback read the system clock instead of the service's
injected now. Test fixtures dated May 2026 fell outside the 180-day
window around October 28, which broke four tests on main.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@hubab1
hubab1 merged commit d6a415c into main Nov 1, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant